
<?php

require_once('ModuleCustomElement.class.php');


require_once('ModuleVideoFilters.class.php');
require_once('ModuleVideoBitrateFilters.class.php');
require_once('ModulePlanSubscriptionFilters.class.php');
require_once('ModuleSignupFilters.class.php');

require_once('ModuleResult.class.php');
require_once('ModuleVideoBitrateResult.class.php');
require_once('ModuleSignupResult.class.php');
require_once('ModuleSubscriptionResult.class.php');

require_once('ModuleOSandBrowserFilters.class.php');
require_once('ModuleOSandBrowserResult.class.php');

require_once('ModuleDailySummaryFilters.class.php');
require_once('ModuleDailySummaryResult.class.php');

require_once('ModuleRegActiveConfirmFilters.class.php');
require_once('ModuleRegActiveConfirmResult.class.php');

require_once('ModuleLogInOutFilters.class.php');
require_once('ModuleLogInOutResult.class.php');

require_once('ModuleForgetPasswordFilters.class.php');
require_once('ModuleForgetPasswordResult.class.php');

require_once('ModuleEditProfileFilters.class.php');
require_once('ModuleEditProfileResult.class.php');

require_once('ModuleMembersStatFilters.class.php');
require_once('ModuleMembersStatResult.class.php');

require_once('ModuleHotSearchKeywordFilters.class.php');
require_once('ModuleHotSearchKeywordResult.class.php');

require_once('ModuleCountrys.class.php');


require_once('countryClass.php');

require_once('parseCountryCode.class.php');
require_once('statClass.php');
require_once('getStatsClass.php');


//function

function transCountry($code){
	$condition['country_code'] = json_decode($code, true);
	  if (!empty($condition['country_code'])) {
                $country_arr = $condition['country_code'];
                $tmp = array();
                foreach($country_arr as $k1=>$v1) {
                    $tmp_stat = '<b>'.$k1.'</b> - ';
                    $tmp_section = array();
                    if (!is_array($v1) && strtolower($v1)=='all') {
                        $tmp[] = '<div>'.$tmp_stat.$v1.'</div>';
                        continue;
                    }
                    foreach($v1 as $k2=>$v2) {
						$tmp_k2 = '';
						if(in_array(strtolower($k1), array('africa','americas'))){
							//$tmp_k2 = '<b>'.$k2.'</b> -';
						}
                        if (!is_array($v2) && strtolower($v2)=='all') {
                            $tmp_section[] = '<div>'.$tmp_stat.$tmp_k2.' ('.$v2.')'.'</div>';
                            continue;
                        }
						$tmp3 = array();
						foreach($v2 as $k3=>$v3){
							$tmp3[] = $v3." ({$k3})";
						}
                        //$tmp_section[] = '<div>'.$tmp_stat.$tmp_k2.' '.implode(', ', $tmp3).'</div>';
                        $tmp_section[] = implode(', ', $tmp3);
                    }
                    $tmp[] = '<div>'.$tmp_stat.' '.implode(',',$tmp_section).'</div>';
                }
                $region_country_list = implode('',$tmp);
            }
 
	return $region_country_list;
}

?>
